package com.zd.xa.multi.datasource.service;

import com.zd.xa.multi.datasource.mapper.admin.AdminMapper;
import com.zd.xa.multi.datasource.mapper.user.UserMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TranseFerMoney {



    @Autowired(required = false)
    UserMapper userMapper;

    @Autowired(required = false)
    AdminMapper adminMapper;


    @GlobalTransactional
    public void transferMoney(double money,double money1){
        adminMapper.reduceMoney(money1);

        userMapper.addMoney(money);


    }
}
